﻿using BonjourQuotation.DataAccess.Repositories;
using BonjourQuotation.ObjectModel.AccountData;
using BonjourQuotation.ObjectModel.ErrorData;
using BonjourQuotation.ObjectModel.GuideData;
using BonjourQuotation.ObjectModel.LoggerData;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace BonjourQuotation.UI.ServiceManagers
{
    public class GuideManager
    {
        private readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        public ErrorBInfo CreateGuideCompanyInfo(GuideCompanyInfoBData GuideData, ref int GuideID)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.CreateGuideCompanyInfo(GuideData, ref GuideID);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ErrorBInfo CreateGuidePersonalInfo(GuidePersonalInfoBData GuideData,ref int GuideID)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.CreateGuidePersonalInfo(GuideData, ref GuideID);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ManageGuidesGridBData LoadGuides(int PageNumber)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadGuides(PageNumber);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ManageGuidesGridBData LoadSearchedGuides(ManageGuidesGridBData Data)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadSearchedGuides(Data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public GuideCompanyInfoBData LoadGuideCompanyInfoByID(int GuideID)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadGuideCompanyInfoByID(GuideID);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public GuidePersonalInfoBData LoadGuidePersonalInfoByID(int GuideID)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadGuidePersonalInfoByID(GuideID);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public GuideAssignmentsBData LoadGuideAssignmentsByID(int GuideID)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadGuideAssignmentsByID(GuideID);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ErrorBInfo SaveGuideCompanyInfoData(GuideCompanyInfoBData Data)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.SaveGuideCompanyInfoData(Data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public ErrorBInfo SaveGuidePersonalInfoData(GuidePersonalInfoBData Data)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.SaveGuidePersonalInfoData(Data);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public Dictionary<string, string> LoadState()
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadState();
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
        public Dictionary<int, string> LoadCity(int CountryID, string StateID)
        {
            try
            {
                var proxy = new GuideRepository();
                return proxy.LoadCity(CountryID, StateID);
            }
            catch (Exception ex)
            {
                logger.Error(ex.ToMessageAndCompleteStacktrace());
                return null;
            } 
        }
    }
}